package javase2.day06;

import javase2.day06.Dog.BabyDog;
/***
 * 成员内部类实例，必须利用外部类实例来创建
 * 成员内部类实例，共享了外部类实例的成员变量
 * @author tarena
 *
 */
public class Demo11 {
	public static void main(String[] args) {
		Dog tom = new Dog("Tom");
		BabyDog d1 = tom.new BabyDog("Mini Tom");
		BabyDog d2 = tom.new BabyDog("Tom lite");
		Dog mac = new Dog("Mac");
		d1.whoru();
		d2.whoru();
	}
}
class Dog{
	String name;
	public Dog(String name){
		this.name=name;
	}
	class BabyDog{
		String name;
		public BabyDog(String name){
			this.name=name;
		}
		public void whoru(){
			System.out.println(Dog.this.name + ","+ this.name);
		}
	}
}